// search的模块小仓库
import { reqgetSearchList } from "@/api";

const state = {
    searchList: {},
};

const mutations = {
    SearchList(state, searchList){
        state.searchList = searchList;
    },
};

const actions = {
    // reqgetSearchList({})至少传一个空对象，不然请求报201；
    async getSearchList({commit}, parmas={}){
        let result = await reqgetSearchList(parmas);
        // console.log(result);
        if(result.code == 200){
            commit("SearchList", result.data)
        }
    },
};

const getters = {
    goodsList(){
        return state.searchList.goodsList || [];
    },

    attrsList(){
        return state.searchList.attrsList || [];
    },

    trademarkList(){
        return state.searchList.trademarkList || [];
    },
};


export default {
    state,
    mutations,
    actions,
    getters
}
